<?php
class CheckAction extends BaseAction{
	// 首页
	public function index(){
		$this->display('check');
	}
	
	// 商户礼券验证
	public function check(){
		$this->display();
	}
	
	/**
	 * 确认消费前的查询
	 */
	public function searchCoupon(){
		$passcode = $_POST['codevalue'];
		if(empty($passcode))exit(json_encode(array('status'=>-1,'msg'=>'请录入'.K('SP_COUPON_NM').'码！')));
		$result = service('Shanghu')->checkPassCode($passcode,$_SESSION['qp_id']);
		exit(json_encode($result));
	}
	
	
	/**
	 * 确认礼券被使用
	 */
	public function confirmCoupon(){
		$passcode = $_POST['codevalue'];
		if(empty($passcode))exit(json_encode(array('status'=>-1,'msg'=>'请录入'.K('SP_COUPON_NM').'码！')));
		$result = service('Shanghu')->doConfirmCoupon($passcode,$_SESSION['qp_id']);
		exit(json_encode($result));
	}
	
	
	/**
	 * 店铺验证的礼券
	 */
	public function checkedlist(){
		/**用来处理带有条件的查询**/
		$partner_id = $_SESSION['qp_id'];
		
		$pdata = D('Partner','Admin')->selectPartnerInfo(array('porppid'=>$partner_id,'psort'=>$map['psort']),'id',null,null);
		$ary_pids = getSubByKey($pdata,"id");
		$couponpagedata = model('Coupon')->search4SH(array('pid'=>$ary_pids,'gid'=>$goods_id) ,'check_time desc', 4);
		
		$this->assign('couponpagedata', $couponpagedata);
		//$this->assign('brandExtInfo', $brandExtInfo);
		
		$this->display();
	}
}

?>